﻿@{
    Layout = null;
}

@model ElingOA6_Admin_DSJCJ.Model.Album
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
<link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
@Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
@Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


<script type="text/javascript">

    function Save() {
        lpModal.Show();
        var bl = true;
        var name = FFileName.GetText();
        if (name == null || ASPxClientUtils.Trim(name) == "") {
            FFileName.SetErrorText("请填写文件名称");
            FFileName.SetIsValid(false);
            bl = false;
        }

        var play = FPlayInterval.GetText();
        if (play == null || ASPxClientUtils.Trim(play) == "") {
            FPlayInterval.SetErrorText("请填写图片间隔时间");
            FPlayInterval.SetIsValid(false);
            bl = false;
        } else {
            if (!isNumeric(play)) {
                FPlayInterval.SetErrorText("图片间隔时间必须是整数!");
                FPlayInterval.SetIsValid(false);
                bl = false;
            }
        }

        var seq = FDispSeq.GetText();
        if (seq == null || ASPxClientUtils.Trim(seq) == "") {
            FDispSeq.SetErrorText("请填写显示顺序");
            FDispSeq.SetIsValid(false);
            bl = false;
        } else {
            if (!isNumeric(seq)) {
                FDispSeq.SetErrorText("显示顺序必须是整数!");
                FDispSeq.SetIsValid(false);
                bl = false;
            }
        }


        if (bl) {
            var bgImg = FBGMusicPathImg.GetText();
            bgImg = bgImg.substring(bgImg.lastIndexOf("."));
            bgImg = bgImg.toLowerCase();
            if (bgImg != "" && bgImg != ".mp3" && bgImg != ".mid" && bgImg != ".wma") {
                alert("请上传以下类型背景音乐文件  .mp3 .mid .wma");
                bl = false;
            }
        }

        if (bl) {
            var img = FContentBinImg.GetText();
            img = img.substring(img.lastIndexOf("."));
            img = img.toLowerCase();
            if (img != "" && img != ".jpg" && img != ".jpeg" && img != ".gif" && img != ".bmp") {
                alert("请上传以下类型封面图片  .jpg .jpeg .gif .bmp");
                bl = false;
            }
        }


        if (bl) {
            form1.submit();
        } else {
            lpModal.Hide();
        }


    }

       

</script>

</head>
<body>
@using (Html.BeginForm("AlbumAddSave", "Album", FormMethod.Post, new { id = "form1" }))
{
    <table class="tableFrom">
        <tr>
            <th width="100px">相册名称:</th>
            <td>
               @Html.DevExpress().TextBox(settings =>
          {
              settings.Name = "FFileName";
              settings.Width = 360;
              settings.Text = Model.FFileName;
              settings.Properties.ValidationSettings.EnableCustomValidation = true;
          }).GetHtml()              
           </td>
           </tr>
           <tr>
            <th>相册描述:</th>
            <td>
               @Html.DevExpress().Memo(settings =>
              {
                  settings.Name = "FContentTxt";
                  settings.Width = 360;
                  settings.Properties.Rows = 3;
                  settings.Text = Model.FContentTxt;
              }).GetHtml()              
           </td>
           </tr>
           <tr>
           <th>图片间隔时间:</th>
           <td>
               @Html.DevExpress().TextBox(settings =>
              {
                  settings.Name = "FPlayInterval";
                  settings.Width = 100;
                  settings.Text = Model.FPlayInterval.ToString();
                  settings.Properties.ValidationSettings.EnableCustomValidation = true;       
              }).GetHtml()
           </td>
           </tr>
           <tr>
           <th>相册背景音乐:</th>
           <td>
               @Html.DevExpress().UploadControl(
            settings =>
            {
                settings.Name = "FBGMusicPathImg";
                settings.BrowseButton.Text = "浏览";
                settings.ClearFileSelectionImage.ToolTip = "清除选择";
                settings.ShowProgressPanel = true;                
                settings.ShowUploadButton = false;
            }).GetHtml()
           </td>
           </tr>
           <tr>
           <th>显示顺序:</th>
           <td>
               @Html.DevExpress().TextBox(settings =>
              {
                  settings.Name = "FDispSeq";
                  settings.Width = 100;
                  settings.Text = Model.FDispSeq.ToString();
                  settings.Properties.ValidationSettings.EnableCustomValidation = true;
              }).GetHtml()
           </td>
           </tr> 
          
          <tr>
           <th>相册封面图片:</th>
           <td>
               @Html.DevExpress().UploadControl(
            settings =>
            {
                settings.Name = "FContentBinImg";
                settings.BrowseButton.Text = "浏览";
                settings.ClearFileSelectionImage.ToolTip = "清除选择";
                settings.ShowProgressPanel = true;                
                settings.ShowUploadButton = false;
            }).GetHtml()
           </td>
           </tr>
           <tr>
            <td></td>
            <td>
                <img alt="" width="165px" height="98px" id="previewImage" src="@ViewData["imgPath"]" />
            </td>
           </tr>
            <tr>
               <th width="100px">录入人:</th>
               <td>
                   @Html.DevExpress().TextBox(settings =>
                   {
                       settings.Name = "FEmpName";
                       settings.Width = 100;
                       settings.Text = Model.FEmpName;
                       settings.ClientEnabled = false;
                   }).GetHtml()
               </td>   
            </tr>
            <tr>
               <th width="100px">录入日期:</th> 
               <td>
                 @Html.DevExpress().TextBox(settings =>
                {
                    settings.Name = "FUpdateTime";
                    settings.Width = 100;
                    if (Model.FUpdateTime.HasValue)
                    {
                        settings.Text = Model.FUpdateTime.Value.ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        settings.Text = DateTime.Now.ToString("yyyy-MM-dd");
                    }               
                    settings.ClientEnabled = false;
                }).GetHtml()

               </td>
            </tr>
      </table>
    
    @Html.Hidden("hdFAlbumClsNo", Model.FAlbumClsNo)
    @Html.Hidden("hdFAlbumId", Model.FAlbumId)
                                  
    
}

<script>
    lp.Hide();
</script>
</body>
</html>